﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            ArrayList s1 = new ArrayList();

            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine("请输入成绩：");
                double num = double.Parse(Console.ReadLine());
                Console.WriteLine("你输入的成绩是：" + num);
                Text1();
                s1.Add(num);
            }


            Console.WriteLine("学生总数");
            double sum = 0;
            for (int i = 0; i < s1.Count; i++)
            {
                sum = sum + (double)s1[i];
            }
            Console.WriteLine("总分数为" + sum);
            double avg = sum / s1.Count;
            Console.WriteLine("平均分为" + avg);
            Console.ReadKey();
        }
        public static void Text1()
        {
            try
            {
                Console.WriteLine("请输入成绩：");
                double d = double.Parse(Console.ReadLine());
                Console.WriteLine("你输入的成绩是：" + d);
            }
            catch (FormatException e)
            {

                Console.WriteLine("异常已处理");
            }
            catch (OverflowException)
            {
                Console.WriteLine("异常已处理");
            }
            catch (Exception)
            {
                Console.WriteLine("异常已处理");
            }
            finally
            {
                Console.WriteLine("结束");
            }
        }
    }
}